import type { ProColumnsTypes } from '@vh-admin/pro-components/lib/t-table-custom/types';
export const columnsFn = (dictionaries: any): ProColumnsTypes<any>[] => {
  return [
    {
      title: '封面',
      dataIndex: 'img_url',
      valueType: 'UploadCustom',
      formGroup: 1,
      search: false,
      hideInTable: true,
      fieldProps: {
        path: 'message',
        maxCount: 1,
        format: ['jpg', 'jpeg', 'png'],
        size: 2000,
        listType: 'picture-card',
        imgCrop: true,
        imgCropFieldProps: { aspect: 2 },
      },
    },
    {
      title: '重要程度',
      dataIndex: 'is_urgent',
      valueType: 'select',
      businessStyle: { type: 'tag' },
      initialValue: 1,
      search: false,
      fieldProps: {
        options: dictionaries.Message.is_urgent,
      },
      formGroup: 1,
    },
    {
      title: '封面',
      dataIndex: 'img_url',
      valueType: 'image',
      search: false,
      hideInForm: true,
      hideInSearch: true,
    },
    {
      title: '标题',
      dataIndex: 'title',
      valueType: 'text',
      copyable: true,
      formGroup: 2,
      fieldProps: { maxLength: 30 },
      formItemProps: { rules: [{ required: true }, { min: 4 }] },
    },
    {
      title: '简介',
      dataIndex: 'desc',
      valueType: 'text',
      ellipsis: true,
      search: false,
      formGroup: 2,
      fieldProps: { maxLength: 200 },
      formItemProps: { rules: [{ required: true }, { min: 4 }] },
    },
    {
      title: '状态',
      dataIndex: 'status',
      valueType: 'select',
      fieldProps: {
        options: dictionaries.Message.status,
      },
      hideInForm: true,
      hideInTable: true,
    },
    {
      title: '类型',
      dataIndex: 'type',
      valueType: 'select',
      fieldProps: {
        options: dictionaries.Message.type,
      },
      hideInForm: true,
      hideInTable: true,
    },
    {
      title: '状态',
      dataIndex: 'status',
      valueType: 'select',
      initialValue: 1,
      fieldProps: {
        options: dictionaries.Message.status,
      },
      search: false,
      formGroup: 3,
      formItemProps: { rules: [{ required: true, message: '请选择状态' }] },
      businessStyle: { type: 'tag' },
    },
    {
      title: '类型',
      dataIndex: 'type',
      initialValue: 1,
      valueType: 'select',
      fieldProps: {
        options: dictionaries.Message.type,
      },
      formGroup: 3,
      search: false,
      formItemProps: { rules: [{ required: true, message: '请选择类型' }] },
    },
    {
      title: '通知范围',
      dataIndex: 'mode',
      valueType: 'select',
      fieldProps: {
        options: dictionaries.Message.mode,
      },
      search: false,
      hideInForm: true,
      hideInSearch: true,
    },
    {
      title: '接收人',
      dataIndex: 'user_ids',
      valueType: 'select',
      tip: '如果选择只会对选中人员发送,不选择则是全部',
      search: false,
      hideInTable: true,
      width: '100%',
      fieldProps: {
        options: dictionaries.AdminUser.self,
        mode: 'multiple',
        style: { width: '688px' },
      },
      formGroup: 4,
    },
    {
      title: '内容',
      dataIndex: 'content',
      valueType: 'BraftEditorCustom',
      formGroup: 5,
      search: false,
      hideInTable: true,
      width: '100%',
      fieldProps: { format: ['jpg', 'jpeg', 'png'], size: 2000 },
      formItemProps: { rules: [{ required: true }] },
    },
  ];
};
